/*
    (1)数组：默认打平 设置Symbol.isConcatSpreadable = false 会导致追加
    (2)类数组：默认追加 设置Symbol.isConcatSpreadable = true 会打平
    (3)其他：默认追加 设置Symbol.isConcatSpreadable = true 会忽略
*/

let inital = ['foo'];

let case1 = ['bar'];
let case2 = {0: 'bar', length: 1};
let case3 = new Set([1]);

// case1:
console.log(inital.concat(case1));   // [ 'foo', 'bar' ]
console.log(case1 [Symbol.isConcatSpreadable]);   // undefined;
case1 [Symbol.isConcatSpreadable] = false;
console.log(inital.concat(case1));    // [ 'foo', [ 'bar', [Symbol(Symbol.isConcatSpreadable)]: false ] ]

// case2: 
console.log(inital.concat(case2));   // [ 'foo', { '0': 'bar', length: 1 } ]
console.log(case2[Symbol.isConcatSpreadable]);   // undefined;
case2[Symbol.isConcatSpreadable] = true;
console.log(inital.concat(case2)); // [ 'foo', 'bar' ]

// case3: 
console.log(inital.concat(case3));   // [ 'foo', Set(1) { 1 } ]
console.log(case3[Symbol.isConcatSpreadable]);   // undefined;
case3[Symbol.isConcatSpreadable] = true;
console.log(inital.concat(case3)); // [ 'foo']